"""
公共基础数据接口模型
"""

from jlpay.model.base import OrgBaseReq, BaseResponse


class BankListRequest(OrgBaseReq):
    """银行总行信息查询请求"""
    
    API_URL = "/open/base/data/bank/list"
    
    def __init__(self):
        """初始化银行总行信息查询请求"""
        super().__init__()
        self.bank_name = None
        self.bank_code = None
        self.limit = None
        self.offset = None
    
    def set_bank_name(self, bank_name):
        """
        设置银行名称
        
        Args:
            bank_name: 银行名称
            
        Returns:
            BankListRequest实例
        """
        self.bank_name = bank_name
        return self
    
    def set_bank_code(self, bank_code):
        """
        设置银行行号
        
        Args:
            bank_code: 银行行号
            
        Returns:
            BankListRequest实例
        """
        self.bank_code = bank_code
        return self
    
    def set_limit(self, limit):
        """
        设置每页记录数
        
        Args:
            limit: 每页记录数
            
        Returns:
            BankListRequest实例
        """
        self.limit = limit
        return self
    
    def set_offset(self, offset):
        """
        设置偏移量
        
        Args:
            offset: 偏移量，pageSize = offset / limit + 1，示例值：如果limit为10，则第二页offset传11
            
        Returns:
            BankListRequest实例
        """
        self.offset = offset
        return self


class BankListResponse(BaseResponse):
    """银行总行信息查询响应"""
    
    def __init__(self, response_dict=None):
        """
        初始化银行总行信息查询响应
        
        Args:
            response_dict: 响应字典
        """
        super().__init__(response_dict)
        self.limit = None
        self.offset = None
        self.total = None
        self.data = None
        
        if response_dict:
            self.limit = response_dict.get('limit')
            self.offset = response_dict.get('offset')
            self.total = response_dict.get('total')
            self.data = response_dict.get('data')


class BankBranchListRequest(OrgBaseReq):
    """分支行信息查询请求"""
    
    API_URL = "/open/base/data/bank-branch/list"
    
    def __init__(self):
        """初始化分支行信息查询请求"""
        super().__init__()
        self.branch_code = None
        self.branch_name = None
        self.bank_code = None
        self.limit = None
        self.offset = None
    
    def set_branch_code(self, branch_code):
        """
        设置银行分支行行号
        
        Args:
            branch_code: 银行分支行行号
            
        Returns:
            BankBranchListRequest实例
        """
        self.branch_code = branch_code
        return self
    
    def set_branch_name(self, branch_name):
        """
        设置银行分支行名称
        
        Args:
            branch_name: 银行分支行名称
            
        Returns:
            BankBranchListRequest实例
        """
        self.branch_name = branch_name
        return self
    
    def set_bank_code(self, bank_code):
        """
        设置银行总行行号
        
        Args:
            bank_code: 银行总行行号
            
        Returns:
            BankBranchListRequest实例
        """
        self.bank_code = bank_code
        return self
    
    def set_limit(self, limit):
        """
        设置每页记录数
        
        Args:
            limit: 每页记录数
            
        Returns:
            BankBranchListRequest实例
        """
        self.limit = limit
        return self
    
    def set_offset(self, offset):
        """
        设置偏移量
        
        Args:
            offset: 偏移量，pageSize = offset / limit + 1，示例值：如果limit为10，则第二页offset传11
            
        Returns:
            BankBranchListRequest实例
        """
        self.offset = offset
        return self


class BankBranchListResponse(BaseResponse):
    """分支行信息查询响应"""
    
    def __init__(self, response_dict=None):
        """
        初始化分支行信息查询响应
        
        Args:
            response_dict: 响应字典
        """
        super().__init__(response_dict)
        self.limit = None
        self.offset = None
        self.total = None
        self.data = None
        
        if response_dict:
            self.limit = response_dict.get('limit')
            self.offset = response_dict.get('offset')
            self.total = response_dict.get('total')
            self.data = response_dict.get('data')


class MccQueryRequest(OrgBaseReq):
    """MCC查询请求"""
    
    API_URL = "/open/base/data/mcc/list"
    
    def __init__(self):
        """初始化MCC查询请求"""
        super().__init__()
        self.mcc_code = None
        self.mcc_desc = None
        self.parent_mcc = None
        self.top_code = None
        self.free_flag = None
        self.small_merchant = None
        self.mcc_level = None
        self.limit = None
        self.offset = None
    
    def set_mcc_code(self, mcc_code):
        """
        设置商户类别码
        
        Args:
            mcc_code: 商户类别码
            
        Returns:
            MccQueryRequest实例
        """
        self.mcc_code = mcc_code
        return self
    
    def set_mcc_desc(self, mcc_desc):
        """
        设置商户类别描述
        
        Args:
            mcc_desc: 商户类别描述
            
        Returns:
            MccQueryRequest实例
        """
        self.mcc_desc = mcc_desc
        return self
    
    def set_parent_mcc(self, parent_mcc):
        """
        设置父代类别码
        
        Args:
            parent_mcc: 父代类别码
            
        Returns:
            MccQueryRequest实例
        """
        self.parent_mcc = parent_mcc
        return self
    
    def set_top_code(self, top_code):
        """
        设置一级类别码
        
        Args:
            top_code: 一级类别码
            
        Returns:
            MccQueryRequest实例
        """
        self.top_code = top_code
        return self
    
    def set_free_flag(self, free_flag):
        """
        设置免费标志：0 否 1 是
        
        Args:
            free_flag: 免费标志，0 否 1 是
            
        Returns:
            MccQueryRequest实例
        """
        self.free_flag = free_flag
        return self
    
    def set_small_merchant(self, small_merchant):
        """
        设置小微商户标志：0 不可用 1 可用
        
        Args:
            small_merchant: 小微商户标志，0 不可用 1 可用
            
        Returns:
            MccQueryRequest实例
        """
        self.small_merchant = small_merchant
        return self
    
    def set_mcc_level(self, mcc_level):
        """
        设置MCC级别
        
        Args:
            mcc_level: MCC级别
            
        Returns:
            MccQueryRequest实例
        """
        self.mcc_level = mcc_level
        return self
    
    def set_limit(self, limit):
        """
        设置每页记录数
        
        Args:
            limit: 每页记录数
            
        Returns:
            MccQueryRequest实例
        """
        self.limit = limit
        return self
    
    def set_offset(self, offset):
        """
        设置偏移量
        
        Args:
            offset: 偏移量，pageSize = offset / limit + 1，示例值：如果limit为10，则第二页offset传11
            
        Returns:
            MccQueryRequest实例
        """
        self.offset = offset
        return self


class MccQueryResponse(BaseResponse):
    """MCC查询响应"""
    
    def __init__(self, response_dict=None):
        """
        初始化MCC查询响应
        
        Args:
            response_dict: 响应字典
        """
        super().__init__(response_dict)
        self.limit = None
        self.offset = None
        self.total = None
        self.data = None
        
        if response_dict:
            self.limit = response_dict.get('limit')
            self.offset = response_dict.get('offset')
            self.total = response_dict.get('total')
            self.data = response_dict.get('data')


class RegionListRequest(OrgBaseReq):
    """地区码查询请求"""
    
    API_URL = "/open/base/data/region/list"
    
    def __init__(self):
        """初始化地区码查询请求"""
        super().__init__()
        self.region_code = None
        self.region_name = None
        self.parent_code = None
        self.region_rank = None
        self.limit = None
        self.offset = None
    
    def set_region_code(self, region_code):
        """
        设置地区码
        
        Args:
            region_code: 地区码
            
        Returns:
            RegionListRequest实例
        """
        self.region_code = region_code
        return self
    
    def set_region_name(self, region_name):
        """
        设置地区名称
        
        Args:
            region_name: 地区名称
            
        Returns:
            RegionListRequest实例
        """
        self.region_name = region_name
        return self
    
    def set_parent_code(self, parent_code):
        """
        设置上级地区码
        
        Args:
            parent_code: 上级地区码
            
        Returns:
            RegionListRequest实例
        """
        self.parent_code = parent_code
        return self
    
    def set_region_rank(self, region_rank):
        """
        设置地区等级：1 省 2市 3区
        
        Args:
            region_rank: 地区等级，1 省 2市 3区
            
        Returns:
            RegionListRequest实例
        """
        self.region_rank = region_rank
        return self
    
    def set_limit(self, limit):
        """
        设置每页记录数
        
        Args:
            limit: 每页记录数
            
        Returns:
            RegionListRequest实例
        """
        self.limit = limit
        return self
    
    def set_offset(self, offset):
        """
        设置偏移量
        
        Args:
            offset: 偏移量，pageSize = offset / limit + 1，示例值：如果limit为10，则第二页offset传11
            
        Returns:
            RegionListRequest实例
        """
        self.offset = offset
        return self


class RegionListResponse(BaseResponse):
    """地区码查询响应"""
    
    def __init__(self, response_dict=None):
        """
        初始化地区码查询响应
        
        Args:
            response_dict: 响应字典
        """
        super().__init__(response_dict)
        self.limit = None
        self.offset = None
        self.total = None
        self.data = None
        
        if response_dict:
            self.limit = response_dict.get('limit')
            self.offset = response_dict.get('offset')
            self.total = response_dict.get('total')
            self.data = response_dict.get('data')


class BankCardBinMatchingRequest(OrgBaseReq):
    """银行卡bin信息查询请求"""
    
    API_URL = "/open/base/data/bank-cardbin/matching"
    
    def __init__(self):
        """初始化银行卡bin信息查询请求"""
        super().__init__()
        self.card_no = None
    
    def set_card_no(self, card_no):
        """
        设置银行卡号
        
        Args:
            card_no: 银行卡号
            
        Returns:
            BankCardBinMatchingRequest实例
        """
        self.card_no = card_no
        return self


class BankCardBinMatchingResponse(BaseResponse):
    """银行卡bin信息查询响应"""
    
    def __init__(self, response_dict=None):
        """
        初始化银行卡bin信息查询响应
        
        Args:
            response_dict: 响应字典
        """
        super().__init__(response_dict)
        self.data = None
        
        if response_dict:
            self.data = response_dict.get('data') 